<?php
session_cache_expire(999999999);
if(!isset($_SESSION)) 
{ 
session_start(); 
} 
if(!isset($_SESSION['user'])){
	echo "timeout";
}else{
	$username = $_SESSION['fullname'];
	$id_employee = $_SESSION['IDEmployee'];
include '../operations/connection.php';	
include 'substring-comment.php';

$id_testproject = $_REQUEST['idtestpro'];
$id = $_REQUEST['idproject'];
$id_employee = $_REQUEST['idemp'];
$newlang = $_REQUEST['newlang'];




$a= (string)(microtime(true)*1000);
$b=split('\.',$a);
$idcommentA= $b[0];

if ($_REQUEST['newlang'] == "EN") {
			include "../value/value_en.php";
		} else if($_REQUEST['newlang'] == "VN") {
			include "../value/value_vn.php";
		}
		else {
			include "../value/value_kr.php";
		}
		
$page = isset ( $_GET["page"] ) ? intval ( $_GET["page"] ) : 1;
$rows_per_page = 20;
$page_start = ( $page - 1 ) * $rows_per_page;
$page_end = $page * $rows_per_page; 

$sqlupdate = "UPDATE pr_testproject SET `c_reopen`=`c_reopen`+1,`Status` = -1 ,DateConfirm ='0000-00-00 00:00:00',`IdPriorityColor`=`IdPriorityColorTemp`,`Delete`=0 WHERE IDTest = '$id_testproject'";
mysql_query($sqlupdate);

$labelreopen = $l_reopen."-%$#@!-#424242";

$sqladdcomment = "insert into pr_comment(IDComment,IDTestProject,IDEmployee,`Comment`,DateComment)
 VALUES('$idcommentA','$id_testproject','$id_employee','$labelreopen',NOW())";
mysql_query($sqladdcomment);

if($username!=""){
	$sqlinserttestpro = "UPDATE pr_testproject SET Comment_Last = '$labelreopen', NameEmployee_Last = '$username',DateConfirm = '0000-00-00 00:00:00',`IdPriorityColor`=`IdPriorityColorTemp`
							WHERE IDTest = '$id_testproject' ";
	mysql_query($sqlinserttestpro);
}

include 'load_listerror.php';
mysql_close($connection);
}
?>